home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-27 | 6.4 KB | 88 lines | [TEXT/Imag] |
- var {Global variable, initially zero}
- RoiLeft,RoiTop,RoiRight,RoiBottom:integer;
-
- macro 'Show Tools [T]';
- begin
- SelectWindow('Tools');
- end;
-
- Macro 'Draw Arrow [A]'
- {Draws an arrow based on the current straight line selection.}
- var
- size,angle,dx,dy,pi,theta:real;
- x1,y1,x2,y2,LineWidth,width,height:integer;
- begin
- size:=12; {pixels}
- angle:=20; {degrees}
- pi:=3.14159;
- GetLine(x1,y1,x2,y2,LineWidth);
- if x1<0 then begin
- beep;
- PutMessage('Use the line tool (straight) to select a line first.');
- exit;
- end;
- MoveTo(x1,y1);
- LineTo(x2,y2);
- KillRoi;
- GetPicSize(width,height);
- y1:=height-y1;
- y2:=height-y2;
- if LineWidth>1 then size:=size*LineWidth*0.5;
- angle:=(angle/180)*pi;
- dx:=x1-x2;
- dy:=y1-y2;
- if dx=0 then begin
- if dy>=0 then theta:=pi/2 else theta:=3/2*pi
- end else begin
- theta:=arctan(dy/dx);
- if dx<0 then theta:=theta+pi;
- end;
- moveto(x2,height-y2);
- lineto(x2+size*cos(theta+angle),height-(y2+size*sin(theta+angle)));
- moveto(x2,height-y2);
- lineto(x2+size*cos(theta-angle),height-(y2+size*sin(theta-angle)));
- end;
-
- macro 'Clear Outside [C]'
- {Erase region outside current selection to background color.}
- begin
- Copy;
- SelectAll;
- Clear;
- RestoreRoi;
- Paste;
- KillRoi;
- end;
-
- macro 'Change Colors';
- {
- Changes the value of pixels in the image that are in
- the current foreground color to the current background
- color. Use Undo if you don't like the result.
- }
- var
- SavePixel,foreground,background:integer;
- begin
- SavePixel:=GetPixel(0,0);
- MakeRoi(0,0,1,1);
- Fill;
- foreground:=GetPixel(0,0);
- Clear;
- background:=GetPixel(0,0);
- PutPixel(0,0,SavePixel);
- PutMessage('Pixels in the foreground color (',foreground:1,') will be changed to the background color (',background:1,').');
- ChangeValues(foreground,foreground,background);
- end;
-
- macro 'Change Values…';
- var
- v1,v2:integer;
- begin
- v1:=GetNumber('Change pixels with this value:',255);
- v2:=GetNumber('to this value:',254);
- ChangeValues(v1,v1,v2);
- end;
-
- macro 'Fix Pseudocolors';
- begin
- ChangeValues(0